package com.hmall.order.listen;

import com.hmall.order.service.IOrderService;
import org.checkerframework.checker.units.qual.A;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class ListenOrderQueue {
    @Autowired
    private IOrderService orderService;


    @RabbitListener(
            bindings = @QueueBinding(
             value = @Queue(name = "delay.queue",durable = "true"),
             exchange = @Exchange(name = "delay.direct",delayed = "true"),
             key = "delay"
            ))
    public void listenOrderDelayedQueue(String orderId){
        orderService.listenOrderDelayedQueue(orderId);
    }
}
